package top.jiangqiang.qyblog.common.config;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.jiangqiang.qyblog.common.id.DefaultIDGenerator;
import top.jiangqiang.qyblog.common.id.IDGenerator;

/**
 * @author JiangQiang
 */
@Configuration
@RequiredArgsConstructor
public class IdGeneratorConfiguration {

    /**
     * 不能使用cache存储已经获取到的最大的id，因为cache本身插入数据也需要生成id
     *
     * @return
     */
    @Bean
    public IDGenerator idGenerator() {
        return DefaultIDGenerator.getInstance();
    }

}
